# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-ssh2
_extname=ssh2
pkgver=1.4
pkgrel=1
pkgdesc="PHP 8.1 extension provide bindings for the libssh2 library - PECL"
url="https://pecl.php.net/package/ssh2"
arch="all"
license="PHP-3.01"
_phpv=81
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev libssh2-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

install_if="php-$_extname php$_phpv"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test
	# Check extension loading, testsuite skips tests if extension broken
	$_php -d extension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
5ed1c5bca325b5cb22ea3b5c0c6d6847bdbd89ceef0e16f790fa01c607686aa664506c67cd54fc420459aa69d9772d70ceda541ad93390d9a668266593a4466d  php-pecl-ssh2-1.4.tgz
"
